package com.example.coursehub.repository;

import com.example.coursehub.entity.Material;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

public interface MaterialRepository extends JpaRepository<Material, String>, JpaSpecificationExecutor<Material> {
    List<Material> findByChapter_ChapterId(String chapterId);

    List<Material> findByCourse_CourseId(String courseId);
    // 根据课程和章节获取资料
    List<Material> findByCourse_CourseIdAndChapter_ChapterId(String courseId, String chapterId);
    // 根据资料标签模糊查询
    List<Material> findByMaterialLabelContaining(String keyword);

    // 根据资料名称模糊查询
    List<Material> findByMaterialNameContaining(String keyword);
}